<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<title>无标题文档</title>
	<link href="/static/css/default.css" rel="stylesheet" type="text/css">
	<link href="/static/css/bootstrap.min.css" rel="stylesheet" type="text/css">
	<link href="/static/css/style/green.css" rel="stylesheet" type="text/css" id='link'>
	<link href="/static/js/datepicker/css/bootstrap-datepicker.css" rel="stylesheet">
</head>

<body style="padding:15px 8px 0px 8px;">



	<div class="classify">{$parenttitle}</div>
	<!--toolbar start-->
	<ul class="toolbar">
		<li><a href="#" class="selected" id="add"><i class="toolico iconfont">&#xe649;</i>添加</a></li>


	</ul>

	<!--toolbar end-->

	<!--tablebox start-->
	<div class="tablebox" id="main">
		   <div class="panel-body">
			<li style="width:250px;;float: left;height:200px;" v-for="uitem in arrayData">
				<div class="" style="height:245px;border: 1px solid #ccc;padding: 5px;margin: 10px;"><img v-bind:src="'/static/uploads/'+uitem.imgurl" width="100%" height="180px;" alt="">
					<div class="caption" style="padding-top: 0px;padding-bottom: 0px;">
						<p class="pic_p">
							<span v-if="uitem.typeid==1">公众号轮播图</span>
							<span v-if="uitem.typeid==2">食谱默认图</span>
							<span style="float:right" v-if="uitem.state==1">启用</span>
							<span style="float:right"  v-if="uitem.state==-1">禁用</span>
						</p>
						<p class="pic_p"><button @click="vupdate(uitem)" type="button" class="btn btn-info btn-xs">修改</button>&nbsp;&nbsp;
							<button @click="vdel(uitem)" type="button" class="btn btn-info btn-xs">删除</button></p>
					</div>
				</div>
			</li>
		</div>
	</div>





	</div>
	<!--tablebox end-->

	<!--pagination start-->


	<!--pagination end-->

</body>
<script type="text/javascript" src="/static/js/jquery.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>

<script src="/static/js/layer/layer.js"></script>

<script type="text/javascript" src="/static/js/vue2.js"></script>
<script type="text/javascript" src="/static/js/vue-nav.js"></script>
<script>
	var vm = new Vue({
		el: "#main",
		data: {
			arrayData: [],

		},
		components: {
			'vue-nav': Vnav
		},
		methods: {
			getdata: function (_keycontent) {  //查询数据

				var self = this;
				$.post("/super/system/getpiclist", {}, function (_result) {
					self.arrayData = _result;

				});

			},
			vupdate: function (uitem) {

				//***************获取数据的方法1，使用jquery获取*****************

				parent.layer.open({
					type: 2,
					title: '信息修改',
					fixed: false, //不固定
					maxmin: true,
					area: ['600px', '450px'],
					content: '/super/system/addpic?id=' + uitem.id
				});

			},
			vdel: function (uitem) {
				var self = this;
				parent.layer.confirm('确定要删除吗?', {
					btn: ['是', '否'] //按钮
				}, function () {
					parent.layer.closeAll('dialog');
					$.post("/super/system/delpic", { "id": uitem.id }, function (data) {
						if (data.status == 200) {
							layer.msg(data.message);
							self.getdata("");
						} else {
							layer.msg(data.message);
						}
					});
				}, function () {

				});

			}
		},
		created: function () {  //初始化事件里边去调用查询方法
			this.getdata("");
		}
	});

	!function () {
		$('#add').on('click', function () {

			parent.layer.open({
				title: '信息添加',
				type: 2,
				area: ['600px', '450px'],
				fixed: false, //不固定
				maxmin: true,
				content: '/super/system/addpic'
			});
		});
	}();
</script>

</html>